package sg.edu.nus.iss.umpire;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public class HomeServlet extends HttpServlet {

	private static final long serialVersionUID = 872817762319437475L;
	
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException{
		response.setContentType("text/html");
		UserService userService = UserServiceFactory.getUserService();
		
		response.getWriter().println("<p>Hello, " +
                userService.getCurrentUser().getEmail() +
                "!  You can <a href=\"" +
                userService.createLogoutURL(request.getRequestURI()) +
                "\">sign out</a>.</p>");
	}
}
